/*
 * $Id: PlaylistUtil.java 536 2008-08-19 08:11:57Z jasta00 $
 *
 * Copyright (C) 2008 Josh Guilfoyle <jasta@devtcg.org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

package org.devtcg.five.music.util;

import org.devtcg.five.music.service.PlaylistService;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;

public class PlaylistUtil
{
	public static boolean bindService(Context ctx, ServiceConnection conn)
	{
		Intent playlist = new Intent(ctx, PlaylistService.class);
		
		ComponentName name = ctx.startService(playlist);

		if (name == null)
			return false;

		boolean bound = ctx.bindService(new Intent().setComponent(name),
		  conn, Context.BIND_AUTO_CREATE);

		if (bound == false)
			return false;
		
		return true;
	}
}
